"""
ASGI config for ePHM_drf_backend project.

It exposes the ASGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/
"""

import os

from django.core.asgi import get_asgi_application
from scripts.set_environment import set_environment_based_on_ip,get_local_ip

ip = get_local_ip()
if ip:
    set_environment_based_on_ip(ip)
else:
    print("Failed to set environment based on IP. Using default settings.")
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "root_backend.settings")

application = get_asgi_application()
